#!usr/bin/env python  
# -*- coding:utf-8 -*-
""" 
@author:robot
@file: title03.py 
@version:
@time: 2023/05/31

https://dream.blog.csdn.net/article/details/129052816

4
4 3 5 2

4
"""


def solve_method(n, nums):
    count = 0
    for i in range(n - 1):
        for j in range(i + 1, n):
            a = nums[i]
            b = nums[j]
            if (a ^ b) > (a & b):
                count += 1
    return count


if __name__ == "__main__":
    n = int(input().strip())
    nums = list(map(int, input().strip().split()))
    res = solve_method(n, nums)
    print(res)
